<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>用户管理</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 20px;
        }
        table {
            width: 80%;
            border-collapse: collapse;
        }
        table, th, td {
            border: 1px solid black;
            padding: 10px;
            text-align: left;
        }
        th {
            background-color: #f2f2f2;
        }
        button {
            margin-right: 5px;
        }
    </style>
</head>
<body>

<h1>用户管理</h1>

<button onclick="addNewUser()">添加用户</button>
<button onclick="deleteSelectedUsers()">删除用户</button>
<button onclick="resetSelectedPasswords()">重置密码</button>

<table>
    <thead>
        <tr>
            <th>选择</th>
            <th>用户ID</th>
            <th>用户名</th>
            <th>用户组</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td><input type="checkbox" data-user-id="1"></td>
            <td>1</td>
            <td>john_doe</td>
            <td>john@example.com</td>
        </tr>
        <tr>
            <td><input type="checkbox" data-user-id="2"></td>
            <td>2</td>
            <td>jane_smith</td>
            <td>jane@example.com</td>
        </tr>
        <tr>
            <td><input type="checkbox" data-user-id="3"></td>
            <td>3</td>
            <td>mike_brown</td>
            <td>mike@example.com</td>
        </tr>
        <!-- Add more users as needed -->
    </tbody>
</table>

<script>
    function deleteSelectedUsers() {
        const checkboxes = document.querySelectorAll('input[type="checkbox"]:checked');
        if (checkboxes.length === 0) {
            alert('No users selected for deletion.');
            return;
        }
        
        checkboxes.forEach(checkbox => {
            const userId = checkbox.getAttribute('data-user-id');
            // Implement user deletion logic here
            alert('User with ID ' + userId + ' has been deleted.');
            // Optionally, you may remove the row from the UI after deletion
            checkbox.closest('tr').remove();
        });
    }

    function resetSelectedPasswords() {
        const checkboxes = document.querySelectorAll('input[type="checkbox"]:checked');
        if (checkboxes.length === 0) {
            alert('No users selected for password reset.');
            return;
        }

        checkboxes.forEach(checkbox => {
            const userId = checkbox.getAttribute('data-user-id');
            // Implement password reset logic here
            alert('Password for user with ID ' + userId + ' has been reset.');
        });
    }

    function addNewUser() {
        // Implement logic to add a new user
        alert('Redirecting to add a new user form...');
    }
</script>

</body>
</html>